$(function(){
	function home_resize(){
		var $win = $(window),
			$head = $('header'),
			$foot = $('footer'),
			minHeight = 500,
			newHeight = $win.height() - ($head.height() - 2) - $foot.height();
	
		$('#home-content,#home-content>div,#content').css({
			height: (newHeight > minHeight ? newHeight : minHeight)
		});
	
	}
	
	home_resize();
	
	$(window).resize(home_resize);
	
	var $captions = $('#captions').bxSlider({
		mode: 'vertical',
		easing: 'easeOutBack',
		speed: 1000,
		pager: false,
		controls: false,
		auto: false,
		wrapperClass: 'captions'
	});
	$('#home-content>div').bxSlider({
		mode: 'fade', 
		speed: 1000, 
		pager: true,
		pagerSelector: '#bx-pager',
		captions: true, 
		auto: true, 
		controls:false, 
		autoHover: true, 
		randomStart: false,
		onBeforeSlide: function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject){
			$captions.goToSlide(currentSlideNumber);
		}
	});
});